package smartcommunityserver.mapper;



import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import smartcommunityserver.bean.NumcountBean;

import java.util.List;

/**
 * @author renmin
 */
@Mapper
public interface NumcountMapper {
    @Select("SELECT\n" +
            "       '小区数量' as name,\n" +
            "    count(*) as num\n" +
            "FROM(SELECT\n" +
            "         communityName\n" +
            "     FROM dws_summary_entrance_guard_log\n" +
            "     GROUP BY communityName\n" +
            "    )a\n" +
            "UNION ALL\n" +
            "SELECT\n" +
            "       '楼栋数量',\n" +
            "    count(*) as num\n" +
            "FROM(SELECT\n" +
            "         houseCode\n" +
            "     FROM dws_summary_entrance_guard_log\n" +
            "     GROUP BY houseCode)a\n" +
            "UNION ALL\n" +
            "SELECT\n" +
            "       '业主数量' as name,\n" +
            "    count(*) as num\n" +
            "FROM(SELECT\n" +
            "         ownerId\n" +
            "     FROM dws_summary_entrance_guard_log\n" +
            "     GROUP BY ownerId)a")
    List<NumcountBean> numcountBean();
}
